<!DOCTYPE html>
<html>
    <head>
        <script src="js/vue.js"></script>
        <script src="js/vue-router.js"></script>
    </head>
    <body>
        <div id="app">
            <router-link to="/login" tag="span">前往登录</router-link>
            <router-link to="/register" tag="span">前往注册</router-link>
            <router-view></router-view>
        </div>
        <script>
            var login = {
                template : '<h1>登陆组件</h1>'
            }

            var register = {
                template : '<h1>注册组件</h1>'
            }

            var routerObj = new VueRouter({
                routes : [
                    { path : '/login' , component : login },
                    { path: '/register' , component : register}
                ]
            });

            var vm = new Vue({
                el:'#app',
                router : routerObj
            });
        </script>
    </body>
</html>